package ui.component {

	import flash.display.Sprite;
	
	import util.DisplayUtil;
	import util.UIUtil;
	
	public class Page11111 extends Sprite {
		
		private var _min:uint;
		private var _max:uint;
		private var _handler:Function;
		
		public function Page(handler:Function) {
			super();
			
			_handler = handler;
		}
		
		public function update(min:uint, max:uint):void {
			clear();
			_min = min;
			_max = max;
			var button:TextButton;
			var length:uint = _max - _min;
			for (var i:int = 0; i<=length; i++) {
				button = UIUtil.getTextButton((_min + i).toString(), ["page_off", "page_off", "page_off"], pageHandler);
				button.id = _min + i;
				button.x = -15 * length + i * 30;
				addChild(button);
			}
		}
		
		private function pageHandler(button:TextButton):void {
			if (_handler != null) {
				_handler(button.id);
			}
		}
		
		public function clear():void {
			DisplayUtil.removeAllChild(this, true);
		}
	}
}